-- attrib_per10floor
-- created by xinj
-- 每前进10层迷宫，获得N个XX

return {
    apply = function(prop, baseValue)
        return prop[3];
    end,

    -- 进入下层触发触发
    trigger = function(who, prop, arg)
        if who.type ~= OBJECT_TYPE_USER then
            return 0;
        end

        -- 客户端此时还在前一层，需要+1计算
        local floor = DungeonM.currentLayer() + 1;

        -- 不是在10层，不处理
        if floor % 10 ~= 0 then
            return 0;
        end

        -- 调用公式计算奖励
        local ret = FormulaM.invoke("CALC_CAREER_BONUS", who, {2, prop[2], prop[3]}, 1);
        -- 给奖励
        for _, bonus in pairs(ret) do
            BonusM.doBonus(bonus, "attrib_per10floor");
        end
        
        EventMgr.fire(event.LAYER_BONUS_EVENT, { ["bonusList"] = ret, });

        return prop[3];
    end,

    record = function(target, prop, path)
        return false;
    end 
};